package com.itheima.array;

/*
     1.求1-500之内能同时被2,5,7整除的所有数及个数并5个一行打印
     2.求100以内能被3整除的数加上能被5整除的数的和
 */
public class WorkArray04 {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 1; i < 501; i++) {
            if ((i % 2 == 0 && i % 5 == 0) && i % 7 == 0) {
                count++;
                System.out.print(i + " ");
                if (count % 5 == 0) {
                    System.out.println();
                }
            }
        }
        System.out.println();
        int sum1 = 0;
        int sum2 = 0;
        int sum3 = 0;
        for (int i = 0; i < 101; i++) {
            if (i % 3 == 0) {
                sum1 += i;
            } else if (i % 5 == 0) {
                sum2 += i;
            }
        }
        sum3 = sum1 +sum2;
        System.out.println("和为"+sum3);
    }
}
